#include <iostream>
#include <ctime>
#include <unistd.h>
#include "threadpool.hpp"
#include "task.hpp"
using namespace std;


int main()
{
    srand(time(nullptr));
    //创建线程库
    // ThreadPool<int> tp;
    ThreadPool<Task> tp;
    tp.start();

    // 创建任务
    while(1)
    {
        int data1 = rand() % 1000;
        int data2 = rand() % 10;
        char c = OP[rand() % 5];
        Task t(data1, data2, c);
        tp.push(t);

        cout << "发送了一个数据 : " + t.getTask() + "\n";

        //tp.push(data);
        //cout << "发送了一个数据 : " + to_string(data) + "\n";
        //sleep(1);
    }
    
    return 0;
}